package tue.cse.advanceddatabases.project;

import java.util.logging.Logger;

public class ManagerBean extends MusicEngineBean{
	
	private boolean _active = true;

	private static final Logger logger = Logger.getLogger(ManagerBean.class
            .getName());
    
    public ManagerBean() {
        logger.info("Manager bean Initialized");
        
    }

	public boolean isActive() {
		return _active;
	}

	public void setActive(boolean active) {
		this._active = active;
	}
	
	@SuppressWarnings("deprecation")
	public String getTopAlbums(){
		String query = queryBegin()+topAlbumsQuery()+queryEnd();
		String result = executeQuery(query, "Albums.xml");
		System.out.println(result);
		return result;
	}
	
	@SuppressWarnings("deprecation")
	public String getTopArtists(){
		String query = queryBegin()+topArtistsQuery()+queryEnd();
		return executeQuery(query, "topartists.xml");
	}
	
	@SuppressWarnings("deprecation")
	public String getTopTracks(){
		String query = queryBegin()+topATracksQuery()+queryEnd();
		return executeQuery(query, "toptracks.xml");	
	}
	
	public void setTopTracks(){
		// do nothing
	}
	
	public void setTopArtists(){
		// do nothing.
	}
	
	String topAlbumsQuery(){
		return "" +
			"" +
			"for $album in //album " +
			"return $album";
	}
	
	String topArtistsQuery(){
		return "" +
			"" +
			"for $artist in //artist " +
			"return $artist";
	}
	
	String topATracksQuery(){
		return "" +
		"" +
		"for $track in //track " +
		"return $track";		
	}
   
    
}
